package com.ubb.dbms.core.fileManagers.binaryFileManager;

public abstract class BinaryFileUtils {

	/**
	 * Converts the given rowNr into offset.
	 */
	public static int rowNrToOffset(int rowNr, int headerLength, int rowLength) {
		return headerLength + (rowNr - 1) * rowLength;
	}
	
	/**
	 * Converts the given offset into rowNr.
	 */
	public static int offsetToRowNr(int offset, int headerLength, int rowLength) {
		return (offset - headerLength) / rowLength + 1;
	}
}
